export const alarmColumns = vm => {
  return [
    { title: "设备名称", align: "center", key: "deviceName" },
    { title: "设备ID", align: "center", key: "deviceNo" },
    { title: "设备位置", align: "center", key: "location" },
    { title: "所属企业", align: "center", key: "companyName" },
    { title: "事件详情", align: "center", key: "content" },
    {
      title: "是否恢复",
      align: "center",
      render: (h, params) => {
        const { errorStatus } = params.row;

        if (errorStatus === 1) {
          return h("Tag", { props: { color: "success" } }, "已恢复");
        }

        return h("Tag", { props: { color: "error" } }, "未恢复");
      }
    },
    {
      title: "事件时间",
      align: "center",
      render: (h, params) => {
        const { createdAt } = params.row;
        return h("span", vm.moment(createdAt).format("YYYY-MM-DD HH:mm:ss"));
      }
    },
    {
      title: "恢复时间",
      align: "center",
      render: (h, params) => {
        const { recoverAt } = params.row;
        if (!!recoverAt)
          return h("span", vm.moment(recoverAt).format("YYYY-MM-DD HH:mm:ss"));
        return h("span", "-");
      }
    }
  ];
};
